# source files

SRC = log/logger.cpp \
      log/util.cpp \
      zip/LZ77.cpp \
      zipReader.cpp \
      zipwriter.cpp \
	  fileutils.cpp \
      jamerzip.cpp

OBJ = $(patsubst %.cpp,obj/%.o,$(SRC))

OUT = libjamerzip.a

#include directories
INCLUDES = -I.\
           -I../src/glist \
           -I../src/gtree \
	   -I../src/log \
	   -I../src

#library paths
LIBS = -L/user/local/lib -lm 

#Compiler flags
CCFLAGS = -g -Wall
LDFLAGS = rcs

#compiler
CCC = g++
AR = ar

default: $(OUT)

$(OBJ): | obj

obj:
	@echo creating objects directory $@
	@mkdir -p $@
	@mkdir -p $(patsubst %/, $@/%, $(sort $(dir $(SRC))))

obj/%.o : %.cpp
	$(CCC) $(INCLUDES) $(CCFLAGS) -c $< -o $@

#archive the library
$(OUT):$(OBJ)
	$(AR) $(LDFLAGS) $(OUT) $(OBJ)

clean:
	rm -f $(OBJ) $(OUT)
	rm -rf obj
